<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            Trâmite - Pesquisar
        </ui:define>

        <ui:define name="content">
            <h:form id="pesquisarTramiteForm">

                <p:messages id="pesquisarTramiteMessages" autoUpdate="true" />

                <f:validateBean disabled="true">
                    
                    <p:fieldset legend="Dados">

                        <div class="row">
                            <div class="column2">
                                <p:outputLabel value="Código do Protocolo" for="codigoProtocoloInputText" />
                            </div>
                            <div class="column4">
                                <p:inputText id="codigoProtocoloInputText" value="#{ managerPesquisarTramite.tramite.protocolo.id }"/>
                            </div>
                        </div>

                    </p:fieldset>                   
                                        
                </f:validateBean>

                <div class="command">
                    <p:commandButton
                        id="pesquisarcommandButton" value="Pesquisar" icon="ui-icon-search"
                        styleClass="ui-priority-primary" oncomplete="widthFix();"
                        update="@form" actionListener="#{ managerPesquisarTramite.pesquisar() }" />
                    <p:commandButton value="Limpar" icon="ui-icon-close" oncomplete="widthFix();"
                        update="@form" actionListener="#{ managerPesquisarTramite.limpar() }" />
                </div>
                
                <p:dataTable styleClass="column12" id="tramitesDataTable" var="tramite"
                        value="#{ managerPesquisarTramite.tramites }"
                        rows="5" paginator="true" paginatorPosition="bottom" emptyMessage="Nenhuma Trâmite encontrado">                    

                    <p:column width="5%" headerText="Opções">
                        <div class="options2">
                            <p:button
                                title="Editar" href="criarTramite.xhtml?tramiteId=#{ tramite.id }"
                                icon="ui-icon-pencil"/>
                            <p:button
                                title="Visualizar" href="visualizarTramite.xhtml?tramiteId=#{ tramite.id }"
                                icon="ui-icon-search"/>
                        </div>
                    </p:column>

                    <p:column headerText="Código do Protocolo">
                        <h:outputText value="#{ tramite.protocolo.id }" />
                    </p:column>

                    <p:column headerText="Unidade Remetente">
                        <h:outputText value="#{ tramite.remetente.nome }" />
                    </p:column>                    

                    <p:column headerText="Unidade Destino">
                        <h:outputText value="#{ tramite.destino.nome }" />
                    </p:column>                     
                    
                    <p:column headerText="Situação">
                        <h:outputText value="#{ tramite.situacao.nome }" />
                    </p:column>

                    <p:column headerText="Prazo de conclusão">
                        <h:outputText value="#{ tramite.prazoConclusao }">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </p:column>                    
                    
                </p:dataTable>                
                
            </h:form>
        </ui:define>
    </ui:composition>

</html>